﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDFL.Windows;
using System.Windows.Forms;

namespace SDFL.ExceptionHandling
{
    public class ExceptionManagerImpl : ExceptionManager
    {
        public override bool HandleException(Exception exceptionToHandle, out Exception exceptionToThrow)
        {            
            MessageDlg.Error(String.Format("{0}:{1}", exceptionToHandle.ToString(), exceptionToHandle.Message),
                String.Format("{0} : Exception", Application.ProductName));

            exceptionToThrow = exceptionToHandle;
            return true;            
        }

        public override bool HandleException(Exception exceptionToHandle)
        {
            MessageDlg.Error(String.Format("{0}:{1}", exceptionToHandle.ToString(), exceptionToHandle.Message),
                String.Format("{0} : Exception", Application.ProductName));

            return true;  
        }

        public override bool HandleException(string exMessage)
        {
            MessageDlg.Error(exMessage, String.Format("{0} : Exception", Application.ProductName));
            return true;
        }

        public override void Process(Action action)
        {
            throw new NotImplementedException();
        }
    }
}
